var per_page =4;//每页显示的条目数
var typeId;//新闻类别
var total;//总记录数
$(document).ready(function(){
    total = $("#totalCount").val();//总记录数
    typeId=$("#typeId").val();
    $("#Pagination").pagination(total, {
        prev_text: "上一页",
        next_text: "下一页",
        num_edge_entries: 2,//两侧显示的首尾分页的条目数
        num_display_entries: 5,//连续分页主体部分显示的分页条目数
        callback: pageselectCallback,
        items_per_page: per_page //每页显示的条目数
    });
    
});
function pageselectCallback(page_index, jq){
    var params = {
        "pageIndex": page_index,
        "pageSize": per_page,
		"typeId":typeId
    };//每页显示的条目数
    $.ajax({
        type: "post",
        url: "front/news!newsPaging",
        data: params,
        dataType: "json",
		async: true,
        success: function(data){
            $("#nlist").html("");
			var pubTime;
			var content;
            $.each(data.newsList, function(index, element){
				content=$.trim(element.content).substr(0, 150);
				pubTime=element.publishTime.substr(0,10)+" "+element.publishTime.substr(11,18);
               // $("#nlist").append("<br><h2 class='nl_title'><a target='_blank' href='front/news!detail?id="+ element.newsId+ "'>" + element.title + "</a></h2><span class='nl_content'>" + "时间：" + element.publishTime + "<br>" + element.content.substr(0, 150) + "...</span>");
            $("#nlist").append("<br><h3 class='nl_title'><a target='_blank' href='front/news!detail?id="+ element.newsId+ "'>" + element.title + "</a></h3><span class='nl_content'>" +content+ "&nbsp;&nbsp;...<br>"+pubTime+"<hr></span>")
			});
        },
        error: function(json){
            return false;
        }
    })
    return false;
    
}

